package com.compass.doctor.ui.chat.view

import android.content.Context
import android.util.AttributeSet
import android.view.LayoutInflater
import android.widget.LinearLayout
import com.compass.doctor.databinding.CustomChatTopViewBinding
import com.compass.framework.ext.gone
import com.compass.framework.ext.visible

/**
 * Description： 自定义ViewBodyTop
 * Date:2023/12/1 21:36
 */
class CustomChatTopView : LinearLayout {
    private lateinit var customChatButtonBinding: CustomChatTopViewBinding
    private var tips: String? = null //提示语内同
    private var tipsType: String? = null //提示语类型
    private var context: Context

    constructor(context: Context) : super(context) {
        this.context = context
        initView(context)
    }

    constructor(context: Context, attrs: AttributeSet?) : super(context, attrs) {
        this.context = context
        initView(context)
    }

    constructor(context: Context, attrs: AttributeSet?, defStyleAttr: Int) : super(
        context,
        attrs,
        defStyleAttr
    ) {
        this.context = context
        initView(context)
    }


    //初始化UI，可根据业务需求设置默认值。
    private fun initView(context: Context) {
        customChatButtonBinding =
            CustomChatTopViewBinding.inflate(LayoutInflater.from(context), this, true)
        customChatButtonBinding.llTips.gone()
    }

    fun setTipsInfo(tips: String?, tipsType: String?) {
        this.tipsType = tipsType
        this.tips = tips

        tips?.let {
            customChatButtonBinding.llTips.visible()
            customChatButtonBinding.chatTopTips.text = tips
        } ?: kotlin.run {
            customChatButtonBinding.llTips.gone()
        }


    }
}